#include <iostream>
#include <vector>

#define FORWARD  0
#define BACKWARD 1

class ListElement;

class Sequence
{
	public:
		Sequence();
		~Sequence(){};
	
		void insertListElement(ListElement *listElement);
		void print(int direction);
	
	private:
		std::vector<ListElement *> listElements;
};

class ListElement
{
	public:
		ListElement();
		virtual ~ListElement(){};
		
		virtual void print(int direction){};
};

class List:public ListElement
{
	public:
		List();
		~List();
		
		void insertSequence(Sequence *seq);
		virtual void print(int direction);
		
	private:
		Sequence *sequence;
};

class Number:public ListElement
{
	public:
		Number(int val);
		~Number(){};
		
		virtual void print(int direction);
		
	private:
		int value;
};

class Program
{
	public:
		Program(ListElement *lst){list = lst;};
		~Program(){};
	
		void print(){list->print(BACKWARD);std::cout<<std::endl;};
		
	private:
		ListElement *list;
};







